Visual Basic (Declaration) | |
---|---|
Public Overloads Shared Function Merge( _ ByVal comparer As IComparer(Of TKey), _ ByVal ParamArray enums() As IEnumerable(Of KeyValuePair(Of TKey,TValue)) _ ) As IEnumerable(Of KeyValuePair(Of TKey,TValue)) |
C# | |
---|---|
public static IEnumerable<KeyValuePair<TKey,TValue>> Merge( IComparer<TKey> comparer, params IEnumerable<KeyValuePair<TKey,TValue>>[] enums ) |
Parameters
- comparer
- enums
Library/Library.Test/TestOrderedEnumeration.cs
C# | Copy Code |
---|---|
var x = new[] { new KeyValuePair<int, int>(1, 1) }; var y = new[] { new KeyValuePair<int, int>(2, 2) }; IEnumerator<KeyValuePair<int, int>> e = OrderedKeyValuePairs<int, int> .Merge(new ReverseOrder<int>(Comparer<int>.Default), x, y) .GetEnumerator(); Assert.IsTrue(e.MoveNext()); Assert.AreEqual(2, e.Current.Key); Assert.IsTrue(e.MoveNext()); Assert.AreEqual(1, e.Current.Key); Assert.IsFalse(e.MoveNext()); |
VB.NET | Copy Code |
---|---|
Dim x As var = New () {New KeyValuePair(Of Integer, Integer)(1, 1)} Dim y As var = New () {New KeyValuePair(Of Integer, Integer)(2, 2)} Dim e As IEnumerator(Of KeyValuePair(Of Integer, Integer)) = OrderedKeyValuePairs(Of Integer, Integer).Merge(New ReverseOrder(Of Integer)(Comparer(Of Integer).[Default]), x, y).GetEnumerator() Assert.IsTrue(e.MoveNext()) Assert.AreEqual(2, e.Current.Key) Assert.IsTrue(e.MoveNext()) Assert.AreEqual(1, e.Current.Key) Assert.IsFalse(e.MoveNext()) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7